﻿using System.Web;
using ASPItalia.ModelVirtualCasting.EntityFramework.Wrappers;

namespace ASPItalia.ModelVirtualCasting.EntityFramework {
	internal class WebContextContainer : IContextContainer {
		private const string CONTEXT_KEY = "EFObjectContext";

		public ContextWrapper Current {
			get { return (ContextWrapper)HttpContext.Current.Items[CONTEXT_KEY]; }
		}

		public void Clear() {
			HttpContext.Current.Items[CONTEXT_KEY] = new ContextWrapper(new ModelVirtualCastingEntities());
		}
	}
}